﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QdArch
{
    public enum StairCategory
    {
        /// <summary>
        /// 双跑楼梯
        /// </summary>
        DogleggedStair
    }
    public class StairCategoryItem : IEnumItem
    {
        public string Name => Value.ToString();
        public StairCategory Value { get; set; }
        public string DisplayName { get; set; }
        public StairCategoryItem(StairCategory value, string displayName)
        {
            Value = value;
            DisplayName = displayName;
        }

        public object GetValue()
        {
            return this.Value;
        }
    }
    public static class StairCategoryExt
    {
        private static List<StairCategoryItem> _itemList;
        public static List<StairCategoryItem> ItemList
        {
            get
            {
                if (_itemList == null)
                {
                    _itemList = new List<StairCategoryItem>();
                    var values = Enum.GetValues(typeof(StairCategory));
                    for (var i = 0; i < values.Length; i++)
                    {
                        var value = (StairCategory)values.GetValue(i);
                        _itemList.Add(new StairCategoryItem(value, value.ToDisplay()));
                    }
                }
                return _itemList;
            }
        }

        public static string ToDisplay(this StairCategory category)
        {
            switch (category)
            {
                case StairCategory.DogleggedStair: return "双跑楼梯";
                default:
                    return string.Empty;

            }
        }
    }
}
